package com.lkd.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lkd.entity.NodeEntity;
import org.apache.ibatis.annotations.*;

@Mapper
public interface NodeDao extends BaseMapper<NodeEntity> {

    /**
     * 根据区域id查找区域的点位数
     * @param regionId 区域id
     * @return 返回值
     */
    Integer selectCountByRegionId(Long regionId);

    @ResultMap(value = "nodeMap")
    @Select("select * from tb_node where id=#{nodeId} limit 1")
    NodeEntity selectNodeById(long nodeId);

    @ResultMap(value = "nodeMap")
    @Select("select * from tb_node where `name` like CONCAT('%',#{name},'%')")
    Page<NodeEntity> searchByName(Page<NodeEntity> page,String name);


}
